<template>
  <!-- 引用主页组件 -->
  <index />
  <!-- <div>
    <button @click="userId(1)">userId改为1</button>
    <button @click="userId(2)">userId改为2</button>
  </div> -->
</template>

<script setup>
import store from '@/store';

function userId(id){
  store.commit('setUserData',{
    username: '登录',
    password: '123',
    userId:id
  })
  console.log(store.state.userData)
}
</script>

<style scoped>
div{
  margin: 10px;
  position: absolute;  
  top: 50%;  
  left: 50%;  
  transform: translate(-50%, -50%);
  z-index: 1;
}

button{
  padding: 10px;
  font-size: 2rem;
}
</style>
